
/**
 * Validates a username.
 * @param {Object} rule - The validation rule.
 * @param {string} value - The value to be validated.
 * @param {function} callback - The callback function.
 */
export const userValidate = (rule, value, callback) => {
    // If the value is empty, return an error
    if (value == "") {
        callback(new Error("用户名不能为空"));
    }   
    // Otherwise, return no error
    else {
        callback();
    }
}



/**
 * Check if a value passes a rule and invoke a callback with an error if not.
 * @param {string} rule - The rule to check against.
 * @param {string} value - The value to be checked.
 * @param {function} callback - The callback function to be invoked.
 */
export const passValidate = (rule, value, callback) => {
    if (value == "") {
        callback(new Error("请输入密码")); // Invoke callback with error message if value is empty
    } else {
        callback(); // Invoke callback without error if value is not empty
    }
}
export const sliderValidator = (rule, value, callback) => {
if(value) {
    callback()
} else {
    callback(new Error("请滑动滑块验证"));
}
}
